package problem392;

//392.判断子序列
//https://leetcode.cn/problems/is-subsequence/?envType=study-plan-v2&envId=top-interview-150

class Solution {
    public boolean isSubsequence(String s, String t) {
        int n = s.length(), m = t.length();
        if(n == 0) return true;
        for(int i = 0, j = 0; j<m; j++) {
            if(i < n && s.charAt(i) == t.charAt(j)) {
                i++;
            }
            if(i == n) return true;
        }
        return false;
    }
}